package com.chukun.thrift.dev;

import com.chukun.thrift.DataException;
import com.chukun.thrift.Person;
import com.chukun.thrift.ThriftPersonService;
import org.apache.thrift.TException;

public class PersonService implements ThriftPersonService.Iface {
    @Override
    public Person findPersonByUserName(String userName) throws DataException, TException {
        System.out.println("received from client : "+userName);
        Person person = new Person();
        person.setUserName(userName);
        person.setAge(12);
        person.setMarried(false);
        return person;
    }

    @Override
    public void savePerson(Person person) throws DataException, TException {
        System.out.println("received from client: ");
        System.out.println(person.getUserName());
        System.out.println(person.getAge());
        System.out.println(person.isMarried());
    }
}
